package com.ruoyi.api.petition.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.petition.domain.LegalClassroom;
import com.ruoyi.petition.service.ILegalClassroomService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Api法制讲堂Controller
 *
 * @author ZWX
 * @date 2025-07-30
 */
@RestController
@RequestMapping("/api/petition/legalClassroom")
@RequiredArgsConstructor
public class ApiLegalClassroomController extends BaseController {
    private final ILegalClassroomService legalClassroomService;

    /**
     * 查询法制讲堂列表
     */
    @GetMapping("/list")
    public TableDataInfo list(LegalClassroom legalClassroom) {
        startPage();
        List<LegalClassroom> list = legalClassroomService.selectLegalClassroomList(legalClassroom);
        return getDataTable(list);
    }

    /**
     * 获取法制讲堂详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(legalClassroomService.selectLegalClassroomById(id));
    }
}
